package com.kaisa.activity.ui;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;
import android.widget.RadioGroup;

import com.kaisa.activity.R;
import com.kaisa.activity.fragment.HomeFragmeng;
import com.kaisa.activity.fragment.MyFragmeng;
import com.kaisa.activity.fragment.SortFragmeng;
import com.kaisa.activity.fragment.StewardFragmeng;
import com.kaisa.activity.utils.FragmentTabUtils;

import org.xutils.x;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {
    private List<Fragment> fragments;
    private RadioGroup rgs;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        x.view().inject(this);
        initView();
    }

    private void initView() {
        rgs = (RadioGroup) findViewById(R.id.main_rgs);
        fragments = new ArrayList<Fragment>();
        fragments.add(HomeFragmeng.newInstance());
        fragments.add(SortFragmeng.newInstance());
        fragments.add(StewardFragmeng.newInstance());
        fragments.add(MyFragmeng.newInstance());
        new FragmentTabUtils(getSupportFragmentManager(), fragments, R.id.main_container, rgs, new FragmentTabUtils.OnRgsExtraCheckedChangedListener() {
            @Override
            public void OnRgsExtraCheckedChanged(RadioGroup radioGroup, int checkedId, int index) {

            }
        });
    }


}
